﻿<%@ Page Language="C#"MasterPageFile="../../MasterPage.Master" AutoEventWireup="true" CodeBehind="ICM_Requisition.aspx.cs" Inherits="KPIS.GERP.GIMS.APP.APP_UI.Form.ICM_Requisition" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="server">
<script type="text/javascript">
    function openStatusEdit(Requsition_Code)
    {
           radopen("../Edit_Form/ICM_Requisition.aspx?Requsition_Code="+Requsition_Code+"&status="+"Edit","WindowDetail" );
    }
    function openStautsAdd()
    {
           radopen("../Edit_Form/ICM_Requisition.aspx"+ "?Requsition_Code="+""+"&status="+"Add" ,"WindowDetail");
    }
    function closeRadWindow(sender, args) {
           $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest('Receive');
    }
</script>  
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="grdRequisition" LoadingPanelID="RadAjaxLoadingPanel1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
       <%-- <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="btnInsert" LoadingPanelID="RadAjaxLoadingPanel1" />
            </UpdatedControls>
        </telerik:AjaxSetting>--%>
        <telerik:AjaxSetting AjaxControlID="grdRequisition">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="grdRequisition" LoadingPanelID="RadAjaxLoadingPanel1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="btnInsert_Item">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="btnInsert_Item" LoadingPanelID="RadAjaxLoadingPanel1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
</AjaxSettings>    
</telerik:RadAjaxManager>
  <div class="moduleDivSlim1000">
   <div class="moduleDivBottom1000">
     <asp:Panel ID="Panel2" runat="server" CssClass="contentPaneDiv" Height="30px" ScrollBars="Auto" >
                <table cellpadding="0" cellspacing="0">
                    <tr class="command-list">
                        <td>
                            <asp:LinkButton ID="btnInsert_Item" runat="server" CausesValidation="false" CssClass="LinkButton" OnClick="btnInsert_Click">
                            <img alt="" src="../Image/Grid/AddRecord.gif" style="border:0px;vertical-align:middle;" />&#160;&#160;เพิ่มข้อมูลใหม่ </asp:LinkButton>
                        </td>
                    </tr>
                </table>
      </asp:Panel>
    </div>
</div>
<div class="moduleDivSlim1000">
  <div class="moduleDivBottom1000">
     <asp:Panel ID="Panel1" runat="server" Height="380px" ScrollBars="Auto" >    
               <div class="header-grid">
                    <asp:Label ID="Label4" runat="server" Text="รายการขอเบิกพัสดุ"></asp:Label>
               </div>
               <table>                          
                     <tr>
                          <td>
                             <asp:Panel runat ="server" ID="PanelCombo">
                                <table>
                                       <tr>
                                          <td>
                                            <asp:Label ID="lblStatusRequest" runat = "server" Text ="กรองสถานะของใบขอเบิกพัสดุ" />
                                          </td>
                                          <td>
                                             <telerik:RadComboBox ID="cmbStatusRequest" Runat="server"  AutoPostBack="true" OnSelectedIndexChanged="cmbStatusRequest_OnSelectedIndexChanged">
                                             </telerik:RadComboBox>
                                          </td>
                                       </tr>
                                </table>
                              </asp:Panel>  
                          </td>
                     </tr>
               </table>                          
               <table>
                      <tr>
                            <td>
                                <telerik:RadGrid ID="grdRequisition" runat="server" AutoGenerateColumns="false"
                                    AllowMultiRowEdit="false" AllowMultiRowSelection="true" ShowStatusBar="true"
                                    Width="900px" Height="288px" AllowPaging="true" AllowFilteringByColumn="false"
                                    GroupingSettings-GroupByFieldsSeparator="&nbsp;&nbsp;&nbsp;&nbsp;"
                                    GroupingSettings-GroupContinuedFormatString=""
                                    GroupingSettings-GroupContinuesFormatString=""
                                    GroupingSettings-GroupSplitFormat="" PageSize ="7" 
                                    OnNeedDataSource="grdRequisition_NeedDataSource" 
                                    OnItemCommand="grdRequisition_ItemCommand" align ="left">
                                    <MasterTableView AllowMultiColumnSorting="True" 
                                        CellSpacing="-1" GroupLoadMode="Client"
                                        ShowGroupFooter="true" 
                                        DataKeyNames="requisition_code" 
                                        NoMasterRecordsText="< ไม่มีข้อมูล >" GroupsDefaultExpanded="true">
                                <RowIndicatorColumn>
                                    <HeaderStyle Width="20px" />
                                </RowIndicatorColumn>
                                <ExpandCollapseColumn>
                                    <HeaderStyle Width="20px" />
                                </ExpandCollapseColumn>
                                <Columns>   
                                    <telerik:GridBoundColumn DataField="requisition_code" 
                                        HeaderText="requisition_code" UniqueName="requisition_code"
                                        FilterControlWidth="100%" AutoPostBackOnFilter="true" 
                                        CurrentFilterFunction="Contains" ShowFilterIcon="false" Visible="false" >
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="requisition_date" DataFormatString="{0:d}"
                                        HeaderText="วันที่ขอเบิก" UniqueName="requisition_date"
                                        FilterControlWidth="100%" AutoPostBackOnFilter="true"
                                        CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="100px"
                                        HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridTemplateColumn DataField="requisition_code" 
                                        HeaderText="เลขที่ขอเบิกของ" ShowFilterIcon="false" HeaderStyle-Font-Bold="true"
                                        HeaderStyle-Width="130px" HeaderStyle-HorizontalAlign="Center" 
                                        FilterControlWidth="100%" UniqueName="requisition_code">
                                        <ItemTemplate >                                                                                                                           
                                            <asp:LinkButton ID="targetControl" runat="server" 
                                                Text='<%# Eval("requisition_code") %>' 
                                                OnClientClick='<%# string.Format("return openStatusEdit(\"{0}\");", Eval("requisition_code")) %>'  > 
                                            </asp:LinkButton><%--OnClientClick='<%# string.Format("return openReceiveEdit(\"{0}\",\"{1}\");", Eval("trans_mas_seq"),"Edit") %>'--%>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridTemplateColumn DataField="description" HeaderText="รายการเบิกของ" ShowFilterIcon="false" HeaderStyle-Font-Bold="true"
                                        HeaderStyle-HorizontalAlign="Center" FilterControlWidth="100%" UniqueName="description">
                                        <ItemTemplate >                                                                                                                           
                                            <asp:LinkButton ID="description" runat="server" 
                                                Text='<%# Eval("description") %>' 
                                                OnClientClick='<%# string.Format("return openStatusEdit(\"{0}\");", Eval("requisition_code")) %>'  > 
                                            </asp:LinkButton>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridBoundColumn DataField="approve_name" 
                                        HeaderText="ผู้อนุมัติ" UniqueName="approve_name"
                                        FilterControlWidth="100%" AutoPostBackOnFilter="true"
                                        CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="130px"
                                        HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="status_name" 
                                        HeaderText="สถานะการเบิก" UniqueName="status_name"
                                        FilterControlWidth="100%" AutoPostBackOnFilter="true"
                                        CurrentFilterFunction="Contains" ShowFilterIcon="false" HeaderStyle-Width="70px" 
                                        HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridTemplateColumn AllowFiltering="false" UniqueName="Delete" HeaderText="ลบ" HeaderStyle-Width="35px" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center"> 
                                        <FilterTemplate></FilterTemplate>
                                        <ItemTemplate>
                                                 &nbsp;&nbsp;&nbsp;
                                             <asp:ImageButton ID="cmdDelete" runat="server" 
                                                CommandName="DataDelete"
                                                ImageUrl="~/App_UI/Image/Grid/Delete.gif" 
                                                OnClientClick="javascript:return confirm('ยืนยันการลบข้อมูลที่เลือก')"
                                                ToolTip="ลบรายการ" width="17" /> 
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                </Columns>
                                <PagerStyle Mode="NumericPages" AlwaysVisible="true" 
                                    FirstPageToolTip="กลับหน้าแรก" LastPageToolTip="ไปหน้าสุดท้าย" 
                                    NextPagesToolTip="หน้าถัดไป" NextPageToolTip="หน้าถัดไป" 
                                    PrevPagesToolTip="ย้อนกลับ" PrevPageToolTip="ย้อนกลับ" />
                                </MasterTableView>
                                <GroupingSettings GroupByFieldsSeparator="&nbsp;&nbsp;&nbsp;&nbsp;" 
                                    GroupContinuedFormatString="" 
                                    GroupContinuesFormatString="" 
                                    GroupSplitFormat="" />
                                <ClientSettings EnableRowHoverStyle="True">
                                    <Selecting AllowRowSelect="true" />
                                    <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                                </ClientSettings>
                          </telerik:RadGrid>
                        </td>
                  </tr>
           </table>
     </asp:Panel>
  </div>
</div>                           
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" >
    <Windows>
        <telerik:RadWindow ID="WindowDetail" runat="server" 
            Width="1020px" Height="545px"
            showcontentduringload="false"  VisibleStatusbar="false"
            Modal="true" Skin = "Vista" behaviors="Close"
            title="รายการเบิกพัสดุ" 
            OnClientClose="closeRadWindow" >
        </telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager> 

</asp:Content>